#ifndef CSR_BT_PANIC_H__
#define CSR_BT_PANIC_H__
/******************************************************************************
 Copyright (c) 2009-2021 Qualcomm Technologies International, Ltd.
 All Rights Reserved.
 Qualcomm Technologies International, Ltd. Confidential and Proprietary.

 REVISION:      $Revision: #6 $
******************************************************************************/

#include "csr_synergy.h"

#include "csr_panic.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Bluestack defined panic IDs */
#define CSR_BT_PANIC_BASE_BLUESTACK                                0x00
#define CSR_BT_PANIC_MYSTERY                                       (CSR_BT_PANIC_BASE_BLUESTACK + 0x00) /* PANIC_MYSTERY */
#define CSR_BT_PANIC_MBLK_MAP_ERROR                                (CSR_BT_PANIC_BASE_BLUESTACK + 0x01) /* PANIC_MBLK_MAP_ERROR */
#define CSR_BT_PANIC_L2CAP_HCI_DATA_CREDITS_INCONSISTENT           (CSR_BT_PANIC_BASE_BLUESTACK + 0x02) /* PANIC_L2CAP_HCI_DATA_CREDITS_INCONSISTENT */
#define CSR_BT_PANIC_INVALID_BLUESTACK_PRIMITIVE                   (CSR_BT_PANIC_BASE_BLUESTACK + 0x03) /* PANIC_INVALID_BLUESTACK_PRIMITIVE */
#define CSR_BT_PANIC_INVALID_ESCO_TX_INTERVAL                      (CSR_BT_PANIC_BASE_BLUESTACK + 0x04) /* PANIC_INVALID_ESCO_TX_INTERVAL */
#define CSR_BT_PANIC_HEAP_EXHAUSTION                               (CSR_BT_PANIC_BASE_BLUESTACK + 0x05) /* PANIC_HEAP_EXHAUSTION */
#define CSR_BT_PANIC_MBLK_MSGFRAG_COALESCE_FAILURE                 (CSR_BT_PANIC_BASE_BLUESTACK + 0x06) /* PANIC_MBLK_MSGFRAG_COALESCE_FAILURE */
#define CSR_BT_PANIC_MBLK_DISCARD_TAIL_ERROR                       (CSR_BT_PANIC_BASE_BLUESTACK + 0x07) /* PANIC_MBLK_DISCARD_TAIL_ERROR */
#define CSR_BT_PANIC_RFCOMM_TIMER_ALREADY_STARTED                  (CSR_BT_PANIC_BASE_BLUESTACK + 0x08) /* PANIC_RFCOMM_TIMER_ALREADY_STARTED */
#define CSR_BT_PANIC_RFCOMM_INVALID_TIMER_TYPE                     (CSR_BT_PANIC_BASE_BLUESTACK + 0x09) /* PANIC_RFCOMM_INVALID_TIMER_TYPE */
#define CSR_BT_PANIC_RFCOMM_INVALID_TIMER_CONTEXT                  (CSR_BT_PANIC_BASE_BLUESTACK + 0x0A) /* PANIC_RFCOMM_INVALID_TIMER_CONTEXT */
#define CSR_BT_PANIC_MBLK_CREATE_FAILURE                           (CSR_BT_PANIC_BASE_BLUESTACK + 0x0B) /* PANIC_MBLK_CREATE_FAILURE */
#define CSR_BT_PANIC_RFCOMM_L2CAP_REGISTER_FAILED                  (CSR_BT_PANIC_BASE_BLUESTACK + 0x0C) /* PANIC_RFCOMM_L2CAP_REGISTER_FAILED */
#define CSR_BT_PANIC_RFCOMM_STREAM_MISMATCH                        (CSR_BT_PANIC_BASE_BLUESTACK + 0x0D) /* PANIC_RFCOMM_STREAM_MISMATCH */
#define CSR_BT_PANIC_DM_ACL_LOCKS_EXHAUSED                         (CSR_BT_PANIC_BASE_BLUESTACK + 0x0E) /* PANIC_DM_ACL_LOCKS_EXHAUSED */
#define CSR_BT_PANIC_INVALID_ULP_BUFFER_SIZE_RESPONSE              (CSR_BT_PANIC_BASE_BLUESTACK + 0x0F) /* PANIC_INVALID_ULP_BUFFER_SIZE_RESPONSE */
#define CSR_BT_PANIC_SM_L2CAP_HANDLER                              (CSR_BT_PANIC_BASE_BLUESTACK + 0x10) /* PANIC_SM_L2CAP_HANDLER */
#define CSR_BT_PANIC_ATT_INVALID_STATE                             (CSR_BT_PANIC_BASE_BLUESTACK + 0x11) /* PANIC_ATT_INVALID_STATE */
#define CSR_BT_PANIC_ATT_INVALID_TYPE                              (CSR_BT_PANIC_BASE_BLUESTACK + 0x12) /* PANIC_ATT_INVALID_TYPE */
#define CSR_BT_PANIC_DM_INVALID_HANDLE                             (CSR_BT_PANIC_BASE_BLUESTACK + 0x13) /* PANIC_DM_INVALID_HANDLE */
#define CSR_BT_PANIC_ATT_FIXED_CID_REG_FAILED                      (CSR_BT_PANIC_BASE_BLUESTACK + 0x14) /* PANIC_ATT_FIXED_CID_REG_FAILED */
#define CSR_BT_PANIC_ATT_MARSHAL_UNMARSHAL_INVALID_STATE           (CSR_BT_PANIC_BASE_BLUESTACK + 0x15) /* PANIC_ATT_MARSHAL_UNMARSHAL_INVALID_STATE */
#define CSR_BT_PANIC_INVALID_TIMER_ID                              (CSR_BT_PANIC_BASE_BLUESTACK + 0x16) /* PANIC_INVALID_TIMER_ID */
#define CSR_BT_PANIC_DM_ACL_SANITY_FAILED                          (CSR_BT_PANIC_BASE_BLUESTACK + 0x17) /* PANIC_DM_ACL_SANITY_FAILED */
#define CSR_BT_PANIC_DM_CLIENT_ACL_NULL                            (CSR_BT_PANIC_BASE_BLUESTACK + 0x18) /* PANIC_DM_CLIENT_ACL_NULL */
#define CSR_BT_PANIC_DM_AE_INVALID_ADV_HANDLE                      (CSR_BT_PANIC_BASE_BLUESTACK + 0x19) /* PANIC_DM_AE_INVALID_ADV_HANDLE */
#define CSR_BT_PANIC_DM_AE_SET_SCAN_PARAM_FAILED                   (CSR_BT_PANIC_BASE_BLUESTACK + 0x1A) /* PANIC_DM_AE_SET_SCAN_PARAM_FAILED */
#define CSR_BT_PANIC_HCISHIM_HCI_SEND_FAILED                       (CSR_BT_PANIC_BASE_BLUESTACK + 0x1B) /* PANIC_HCISHIM_HCI_SEND_FAILED */
#define CSR_BT_PANIC_BLUESTACK_UNEXPECTED_HCI_COMMAND_COMPLETE     (CSR_BT_PANIC_BASE_BLUESTACK + 0x1C) /* PANIC_BLUESTACK_UNEXPECTED_HCI_COMMAND_COMPLETE */
#define CSR_BT_PANIC_DM_MARSHAL_UNMARSHAL_INVALID_STATE            (CSR_BT_PANIC_BASE_BLUESTACK + 0x1D) /* PANIC_DM_MARSHAL_UNMARSHAL_INVALID_STATE */
#define CSR_BT_PANIC_DM_MULTIPLE_ACL_LIST_FOUND                    (CSR_BT_PANIC_BASE_BLUESTACK + 0x1E) /* PANIC_DM_MULTIPLE_ACL_LIST_FOUND */
#define CSR_BT_PANIC_L2CAP_READ_CONFTAB_FAILED                     (CSR_BT_PANIC_BASE_BLUESTACK + 0x1F) /* PANIC_L2CAP_READ_CONFTAB_FAILED */
#define CSR_BT_PANIC_L2CAP_INVALID_CID                             (CSR_BT_PANIC_BASE_BLUESTACK + 0x20) /* PANIC_L2CAP_INVALID_CID */
#define CSR_BT_PANIC_L2CAP_MBLK_DATA_LEN_MTU_MISMATCH              (CSR_BT_PANIC_BASE_BLUESTACK + 0x21) /* PANIC_L2CAP_MBLK_DATA_LEN_MTU_MISMATCH */
#define CSR_BT_PANIC_L2CAP_MALLOC_FAILED                           (CSR_BT_PANIC_BASE_BLUESTACK + 0x22) /* PANIC_L2CAP_MALLOC_FAILED */
#define CSR_BT_PANIC_L2CAP_CONFIG_BUF_NULL                         (CSR_BT_PANIC_BASE_BLUESTACK + 0x23) /* PANIC_L2CAP_CONFIG_BUF_NULL */
#define CSR_BT_PANIC_L2CAP_FLOW_CTRL_INSTANCE_SANITY_FAILED        (CSR_BT_PANIC_BASE_BLUESTACK + 0x24) /* PANIC_L2CAP_FLOW_CTRL_INSTANCE_SANITY_FAILED */
#define CSR_BT_PANIC_L2CAP_MARSHAL_UNMARSHAL_INVALID_STATE         (CSR_BT_PANIC_BASE_BLUESTACK + 0x25) /* PANIC_L2CAP_MARSHAL_UNMARSHAL_INVALID_STATE */
#define CSR_BT_PANIC_RFCOMM_MARSHAL_UNMARSHAL_INVALID_STATE        (CSR_BT_PANIC_BASE_BLUESTACK + 0x26) /* PANIC_RFCOMM_MARSHAL_UNMARSHAL_INVALID_STATE */
#define CSR_BT_PANIC_SDM_MARSHAL_UNMARSHAL_INVALID_STATE           (CSR_BT_PANIC_BASE_BLUESTACK + 0x27) /* PANIC_SDM_MARSHAL_UNMARSHAL_INVALID_STATE */
#define CSR_BT_PANIC_SDM_CIS_INSTANCE_NOT_FOUND                    (CSR_BT_PANIC_BASE_BLUESTACK + 0x28) /* PANIC_SDM_CIS_INSTANCE_NOT_FOUND */
#define CSR_BT_PANIC_SM_MARSHAL_UNMARSHAL_INVALID_STATE            (CSR_BT_PANIC_BASE_BLUESTACK + 0x29) /* PANIC_SM_MARSHAL_UNMARSHAL_INVALID_STATE */
#define CSR_BT_PANIC_SM_PAIRING_SANITY_FAILURE                     (CSR_BT_PANIC_BASE_BLUESTACK + 0x2A) /* PANIC_SM_PAIRING_SANITY_FAILURE */
#define CSR_BT_PANIC_SM_RANDOM_GENERATION_FAILURE                  (CSR_BT_PANIC_BASE_BLUESTACK + 0x2B) /* PANIC_SM_RANDOM_GENERATION_FAILURE */
#define CSR_BT_PANIC_SM_INVALID_RPA_TYPE                           (CSR_BT_PANIC_BASE_BLUESTACK + 0x2C) /* PANIC_SM_INVALID_RPA_TYPE */
#define CSR_BT_PANIC_SM_ACL_NOT_IN_PAIRING_LIST                    (CSR_BT_PANIC_BASE_BLUESTACK + 0x2D) /* PANIC_SM_ACL_NOT_IN_PAIRING_LIST  */

/* Synergy profiles defined panic IDs */
#define CSR_BT_PANIC_BASE_PROFILES                          0x40
#define CSR_BT_PANIC_UNSUPPORTED_FEATURE                    (CSR_BT_PANIC_BASE_PROFILES + 0x00) /* Unsupported feature used */

#ifdef HYDRA
/* ToDo: Port it correctly */
#define BLUESTACK_PANIC(panic_code)
#else
#define BLUESTACK_PANIC(panic_code) \
    CsrPanic(CSR_TECH_BT, (CsrUint16)(panic_code), "BLUESTACK_PANIC")
#endif

#ifdef __cplusplus
}
#endif

#endif /* CSR_BT_PANIC_H__ */

